package cn.com.dycc.sys_manage.rolesysmanagement.controller;


import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.com.dycc.common.controller.BaseController;
import cn.com.dycc.sys_manage.rolesysmanagement.service.RoleUserService;
import cn.com.dycc.sys_manage.usersysmanagement.entity.UserInfoAccount;
import cn.com.dycc.util.JsonObjectResult;
import cn.com.dycc.util.JsonResult;

@Controller
@RequestMapping("/roleuser")
public class RoleUserController extends BaseController{
	
	@Resource(name="roleUserService")
	private RoleUserService roleUserService;
	
	//点击增加权限，查询用户列表，给用户增加权限
	@RequestMapping("/add.do")
	@ResponseBody
	public JsonObjectResult addListRoleUser(String role_no,String[] privIds){
		String mes = roleUserService.addListRoleUser(role_no, privIds);
		return new JsonObjectResult(mes);	
	}
	
	//根据角色id查询已授权用户的信息
	@RequestMapping("/findlist.do")
	@ResponseBody
	public JsonObjectResult findUserInfoByRoleNo(String role_no){
		List<UserInfoAccount> list = roleUserService.findUserInfoByRoleNo(role_no);
		return new JsonObjectResult(list);	
	}
}
